home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10371 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: pubxfer.news.psi.net!usenet
  2. From: bweiss@somehost.somedomain (Bill Weiss)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: What's wrong with this program under Borland C++ 4.52?
  5. Date: 7 Mar 1996 14:40:50 GMT
  6. Organization: ASSET InterTech, Inc.
  7. Message-ID: <4hmshi$nvj@client1.news.psi.net>
  8. References: <96063.152225IO92118@MAINE.MAINE.EDU>
  9. NNTP-Posting-Host: host48.asset-intertech.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. In article <96063.152225IO92118@MAINE.MAINE.EDU>, IO92118@MAINE.MAINE.EDU 
  15. says...
  16. >
  17. >I typed in a first sample program for window programming.
  18. >
  19. >I did everything as book says, but it doesn't work.
  20. >
  21. >What's wrong with it?
  22. >
  23. >I check several examples in BC45 for OWL.
  24. >
  25. >It looks like I should use #include <owl/applicat.h>
  26. >#include <owl/framewin.h>
  27. >
  28. >I changed HANDLE with HINSTANCE, it doesn't work.
  29. >I tried almost all the combination to do anything I can.
  30. >If you happen the problems, could you mail to me?
  31. >Thank you very much for your help!!!
  32. >
  33. >han
  34. >
  35. >The following is program:
  36. >//****************************************************************************
  37. >#include <owl.h>
  38. >
  39. >class TSampApp : public TApplication {
  40. >     public:
  41. >          TSampApp(LPSTR AName, HANDLE hInstance, HANDLE hPrevInstance, LPSTR
  42. >lpCmdLine, int nCmdShow) : TApplication(AName, hInstance, hPrevInstance,
  43. >lpCmdLine,
  44. >nCmdShow) {};
  45. >          virtual void InitMainWindow();
  46. >};
  47. >
  48. >void TSampApp::InitMainWindow()
  49. >{
  50. >
  51. >     MainWindow = new TWindow(NULL, Name);
  52. >
  53. >}
  54. >
  55. >int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine,
  56. >int nCmdShow)
  57. >{
  58. >     TSampApp SampApp ("SAMPLE WINDOW", hInstance, hPrevInstance,lpCmdLine,
  59. >nCmdShow);
  60. >
  61. >     SampApp.Run();
  62. >
  63. >     return SampApp.Status;
  64. >
  65. >}
  66. >
  67.  
  68. When build OWL programs I include the header files you mention above. Also I 
  69. believe the main window needs to be of type TFrameWindow not TWindow. I also 
  70. think that your supposed to use OwlMain instead of WinMain. Other than the 
  71. things I mentioned it looks OK.
  72.  
  73. Bill
  74.  
  75.